Skip to content

Fix empty device list on recent macOS (collapsed ScrollView + missing mic permission)#28

Open
e-gons wants to merge 1 commit into
tobi:mainfrom
e-gons:fix/macos-26-device-list
Open

Fix empty device list on recent macOS (collapsed ScrollView + missing mic permission)#28
e-gons wants to merge 1 commit into
tobi:mainfrom
e-gons:fix/macos-26-device-list

Conversation

@e-gons

@e-gons e-gons commented Jun 29, 2026

Copy link
Copy Markdown

Summary

On recent macOS versions the menu bar popover shows the mode toggle and volume slider but no devices at all — Speakers, Headphones, and Microphones sections are all blank, even though devices exist and the default output works (the volume slider is functional).

This PR fixes two independent regressions that surfaced as macOS evolved.

1. Device rows collapsed to zero height

The device list is wrapped in a ScrollView with only .frame(maxHeight: 420). A ScrollView has no intrinsic content height, so inside the self-sizing MenuBarExtra(...).menuBarExtraStyle(.window) window it collapses to ~0pt, hiding every device row between the header and footer. (The header/footer have intrinsic sizes, so they still render — which is why the popover looked half-empty.)

Fix: measure the content height via a GeometryReader + PreferenceKey and size the ScrollView to its content, capped at 420pt (scrolls beyond that).

2. Input devices hidden without Microphone permission

macOS hides audio input streams from apps that lack Microphone permission, so hasStreams(input:) returns 0 for every device and no microphones are ever listed. The app had no NSMicrophoneUsageDescription and never requested access, so it could never be granted.

Fix: add NSMicrophoneUsageDescription and request mic access on launch via AVCaptureDevice.requestAccess(for: .audio), refreshing the device list once the user responds. The request only fires when status is .notDetermined, so users are prompted at most once.

Testing

  • Built with Xcode 27 (macOS 26 beta), Release config.
  • Verified all Speakers, Headphones, and Microphone devices now appear and are selectable.
  • Confirmed the mic permission prompt appears once and persists across launches.

Notes

  • The two fixes are logically independent but kept in a single commit; happy to split if preferred.
  • No behavior change on the output side beyond making the existing rows visible.

- self-size MenuBarExtra ScrollView; device rows were collapsing to
  zero height inside the self-sizing menu bar window, hiding all
  speakers/headphones/microphones
- request microphone permission (NSMicrophoneUsageDescription +
  AVCaptureDevice.requestAccess) so input devices are visible; macOS
  hides input streams from apps without mic access

Amp-Thread-ID: https://ampcode.com/threads/T-019f147f-7c38-7317-a209-e452190dd76c
Co-authored-by: Amp <amp@ampcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant